<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${BaseContext }">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>信息表</title>
<link href="static/css/amazeui.css" rel="stylesheet">
<link rel="shortcut icon" href="favicon.ico" />

<link href="static/css/bootstrap.min.css" rel="stylesheet">
<link href="static/css/jquery-confirm.min.css" rel="stylesheet">
</head>
<body>

<div class="am-container dataDiv">
			<section class="am-panel am-panel-primary">
			  <header class="am-panel-hd">
			    <h3 class="am-panel-title">考试功能演示</h3>
			  </header>
			  <div class="am-panel-bd" id="loadDiv">
					<table class="am-table am-table-bordered am-text-center">
						<thead>
							<tr>
								<th colspan="3">
									<button title="点击此按钮刷新下方表格数据，ajax处理" id="flushBtn" class="am-btn am-btn-primary">刷新数据</button>
								</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${users }" var="u" varStatus="i">
								<tr>
									<th><input type="checkbox" name="checkid" id="checkAll" ></th>
									<td>${u.name }</td>
									<td>${u.age }</td>
								</tr>
							</c:forEach>
							<tr>
								
								<td colspan="3">
									<button class="am-btn am-btn-primary"  onclick="checkAll();" title="点击后将所有数据的checkbox修改为选中状态">全选
									<span class="badge" id="countSpan">0</span>
									</button>
									<button class="am-btn am-btn-primary" title="点击后将所有数据的checkbox修改为未选中状态">全不选</button>
									<button class="am-btn am-btn-primary" title="点击后，已选择的checkbox改为未选择，未选择的checkbox改为已选择">反选</button>
									<button class="am-btn am-btn-warning" title="点击后提交已选择数据的value值">提交已选择数据</button>
								</td>
							</tr>
						</tbody>
					</table>
			  </div>
			</section>
		</div>
<script src="static/js/jquery-1.12.4.min.js"></script>
<script>

$(function(){
	$('#flushBtn').click(function(){
		$(this).load('admin/index.do');
		location.reload();
	});
});

function checkAll(){
	var ca = document.getElementById('checkAll');
	var check = ca.checked;
	var checkboxes = document.getElementsByName('checkid');
	for(var i=0;i<checkboxes.length;i++){
		var c = checkboxes[i];
		if(check){
			c.checked=true;
		}else{
			c.checked=false;
		}	
	}
}

</script>

<script>

</script>

</body>
</html>